package com.sure.supermarketserver.sell.statistics;

import com.sure.supermarketserver.common.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: fyf
 * @Date: 2021/07/19/11:58
 * @Description:
 */
@RestController
@RequestMapping("/statistics/manage")
public class StatisticsAPI {
    @Resource
    private StatisticsService statisticsService;

    @GetMapping("statistics")
    public Result statistics(){
        List<StatisticsVO> list = new ArrayList<>();
        //查询近7天的每天销售数量统计
        try {
            list = statisticsService.statistics();
        }catch (Exception e) {
            return Result.fail(Result.ERR_CODE_BUSINESS, e.getMessage());
        }
        return Result.success(list);
    }
}
